from django.shortcuts import render
from django.http import JsonResponse, HttpResponse
from django.conf import settings
from user.models import User, VSession, WarZone, Company, IPSystem
from user.dataCheck import DataCheck
from log.models import UserLog
from storehouse.models import Storehouse
import pdb, os, time, requests, base64, json
import datetime
import logging, random
from conf.sysConfig import config
from PIL import Image, ImageDraw, ImageFont
from software.views.view_download import download
from order.views.createOrder import random_str
from software.utils import fileStore
from pprint import pprint

logger_request = logging.getLogger("django.request")


def Tem(request, *args, **kwargs):
    form = request.checkForm
    requestParam = form.cleaned_data
    logger_request.info(requestParam)

    pass

    data = {
        "code": 0,
        "msg": "success",
    }
    logger_request.info(data)
    return JsonResponse(data)


def searchUser(request, *args, **kwargs):
    form = request.checkForm
    requestParam = form.cleaned_data
    logger_request.info(requestParam)

    user = User.objects.filter(username=requestParam['userName'])
    if user.exists():
        user1 = user[0]
        userData = {    
            "name": user1.username,
            "createTime": user1.createTime
        }
    else:
        userData = {}

    data = {
        "code": 0,
        "msg": "success",
        "data": userData,
    }
    logger_request.info(data)
    return JsonResponse(data)
